package list2;

public class ListIterRO implements ListIter {
	/*@ readonly @*/ Entry cur;
	
	/*@ pure @*/
	public ListIterRO(/*@ readonly @*/ List list) {
		cur = list.first;
	}
	
	/*@ pure @*/
	public /*@ readonly @*/ Object getCurrent() {
		return cur != null ? cur.data : null;
	}
	
	public void next() {
		if (cur != null) {
			cur = cur.next;
		}
	}

	/*@ pure @*/
	public boolean hasCurrent() {
		return cur != null;
	}
}
